package cloudlearn.hello.controller;

import cloudlearn.hello.bean.User;
import cloudlearn.hello.bean.UserParam;
import cloudlearn.hello.feign.TestFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * Project Name: cloud-learn
 * File Name: UserController
 * Package Name: cloudlearn.hello.controller
 * Date: 2018/7/12  13:44
 * Copyright (c) 2018, tianyul All Rights Reserved.
 */
@RestController
@RequestMapping("/user")
public class UserController {


    @Autowired
    private TestFeign testFeign;

    @PostMapping(value = "/test")
    public void test () {
        testFeign.test();

        System.out.println("***************************************************************");
        testFeign.test2();
    }
    @PostMapping(value = "/query")
    public List<User> query(@RequestBody UserParam userParam) {
        List<User> users = new ArrayList<>();
        User user = new User();
        user.setId(1L);
        user.setUserName("小明");
        user.setAge(10);
        user.setSex(1);
        user.setPhone("1123123123123");
        user.setCreateTime(System.currentTimeMillis());

        users.add(user);

        return users;
    }

    @PostMapping(value = "/add")
    public void add(@RequestBody UserParam userParam) {

    }
}
